import request from '@/utils/axios'

/**
 * 收藏相关API接口
 */
export const collectApi = {
  // 添加收藏
  addCollect(goodsId) {
    return request({
      url: '/collect/add',
      method: 'post',
      data: { goodsId }
    })
  },

  // 取消收藏
  removeCollect(goodsId) {
    return request({
      url: `/collect/remove/${goodsId}`,
      method: 'delete'
    })
  },

  // 获取收藏列表
  getCollectList(params) {
    return request({
      url: '/collect/list',
      method: 'get',
      params
    })
  },

  // 检查是否已收藏
  checkCollected(goodsId) {
    return request({
      url: `/collect/check/${goodsId}`,
      method: 'get'
    })
  },

  // 批量取消收藏
  batchRemoveCollect(goodsIds) {
    return request({
      url: '/collect/batch-remove',
      method: 'delete',
      data: { goodsIds }
    })
  }
}